package info.motteke.qjdbc.column;

import info.motteke.qjdbc.column.filter.BetweenFilter;
import info.motteke.qjdbc.column.filter.EqualFilter;
import info.motteke.qjdbc.column.filter.GreaterFilter;
import info.motteke.qjdbc.column.filter.GreaterOrEqualFilter;
import info.motteke.qjdbc.column.filter.InFilter;
import info.motteke.qjdbc.column.filter.LessFilter;
import info.motteke.qjdbc.column.filter.LessOrEqualFilter;
import info.motteke.qjdbc.column.variable.BigDecimalVariable;
import java.math.BigDecimal;

/**
 * NUMERIC、DECIMALに対応します。
 *
 * @author YWak
 *
 */
public final class BigDecimalMeta extends Meta {

    public BigDecimalMeta(String name) {
        super(name);
    }

    public EqualFilter equal(BigDecimal value){
        return equal(new BigDecimalVariable(value));
    }

    public EqualFilter equal(BigDecimalVariable var){
        return new EqualFilter(var);
    }

    public GreaterFilter greaterThan(BigDecimal value) {
        return greaterThan(new BigDecimalVariable(value));
    }

    public GreaterFilter greaterThan(BigDecimalVariable var) {
        return new GreaterFilter(var);
    }

    public GreaterOrEqualFilter greaterThanOrEqual(BigDecimal value) {
        return greaterThanOrEqual(new BigDecimalVariable(value));
    }

    public GreaterOrEqualFilter greaterThanOrEqual(BigDecimalVariable var) {
        return new GreaterOrEqualFilter(var);
    }

    public LessFilter lessThan(BigDecimal value) {
        return lessThan(new BigDecimalVariable(value));
    }

    public LessFilter lessThan(BigDecimalVariable var){
        return new LessFilter(var);
    }

    public LessOrEqualFilter lessThanOrEqual(BigDecimal value){
        return lessThanOrEqual(new BigDecimalVariable(value));
    }

    public LessOrEqualFilter lessThanOrEqual(BigDecimalVariable var){
        return new LessOrEqualFilter(var);
    }

    public BetweenFilter between(BigDecimal start, BigDecimal end) {
        return between(new BigDecimalVariable(start), new BigDecimalVariable(end));
    }

    public BetweenFilter between(BigDecimalVariable start, BigDecimalVariable end){
        return new BetweenFilter(start, end);
    }

    public InFilter in(BigDecimal...values){
        BigDecimalVariable[] vars = new BigDecimalVariable[values.length];

        for(int i = 0; i < values.length; i++){
            vars[i] = new BigDecimalVariable(values[i]);
        }

        return in(vars);
    }

    public InFilter in(BigDecimalVariable... vars){
        return new InFilter(vars);
    }
}
